package org.hegang.design.first.abstractfactorypattern;

import org.hegang.design.first.abstractfactorypattern.impl.Blue;
import org.hegang.design.first.abstractfactorypattern.impl.Green;
import org.hegang.design.first.abstractfactorypattern.impl.Red;
import org.hegang.design.common.CommonFields;

/**
 * @ClassName ColorFactory
 * @Describe: 颜色工厂
 * @Author: gang.he
 * @Email: SmileSkylife@outlook.com
 * @Date: Created in 22:41 2019/6/28
 * @Modified By:
 * @Version V1.0
 */
public class ColorFactory extends AbstractFactory{
    @Override
    public Shape getShape(String shape) {
        return null;
    }

    @Override
    public Color getColor(String colorType){
        if (null == colorType){
            return null;
        }
        if (colorType.trim().equalsIgnoreCase(CommonFields.RED)){
            return new Red();
        }else if (colorType.trim().equalsIgnoreCase(CommonFields.GREEN)){
            return new Green();
        }else if (colorType.trim().equalsIgnoreCase(CommonFields.BLUE)){
            return new Blue();
        }
        return null;
    }
}
